#define _CRT_SECURE_NO_WARNINGS
#include<algorithm>
#include<iostream>
void quicksort1(int * a,int begin,int end)
{
	if (begin >= end) return;
	int left = begin;
	int right = end;
	int key = a[left];
	int cur = left + 1;
	while (cur <= right)
	{
		if (a[cur] < key)
		{
			std::swap(a[left], a[cur]);
			left++;
			cur++;
		}
		else if (a[cur] > key)
		{
			std::swap(a[cur], a[right]);
			right--;
		}
		else
		{
			cur++;
		}
	}
	quicksort1(a, begin, left);
	quicksort1(a, cur, end);
}
int main()
{
	int a[15] = { 323,4,3254,3453,5434,5435,543,5,543,534,543,234,2535,32,43 };
	quicksort1(a, 0, 14);
	for (size_t i = 0; i < 15; i++)
	{
		std::cout << a[i] << " ";
	}
}